chore(TextInputGroup): Added default as an option for validated#12349
chore(TextInputGroup): Added default as an option for validated#12349tlabaj wants to merge 1 commit intopatternfly:mainfrom
Conversation
WalkthroughAdded support for a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preview: https://pf-react-pr-12349.surge.sh A11y report: https://pf-react-pr-12349-a11y.surge.sh |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/react-core/src/components/TextInputGroup/TextInputGroup.tsx (1)
39-49: Consider centralizing the status-capable validation states.The same
['success', 'error', 'warning']source of truth now exists here and again inpackages/react-core/src/components/TextInputGroup/TextInputGroupMain.tsxLine 89. Pulling that into a shared helper/constant would make the next validation-state change less likely to desync styling and icon behavior.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/react-core/src/components/TextInputGroup/TextInputGroup.tsx` around lines 39 - 49, The list of validation states is duplicated; extract the array ['success','error','warning'] into a shared constant (e.g., VALIDATED_STATES) exported from a new or existing shared module and replace the inline arrays in TextInputGroup (used by hasValidatedModifier) and TextInputGroupMain (the usage at Line 89) to import and reference VALIDATED_STATES; update hasValidatedModifier to compute const hasValidatedModifier = VALIDATED_STATES.includes(validated) and ensure any type casts or keyof narrowing still work with the shared constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/react-core/src/components/TextInputGroup/TextInputGroup.tsx`:
- Around line 39-49: The list of validation states is duplicated; extract the
array ['success','error','warning'] into a shared constant (e.g.,
VALIDATED_STATES) exported from a new or existing shared module and replace the
inline arrays in TextInputGroup (used by hasValidatedModifier) and
TextInputGroupMain (the usage at Line 89) to import and reference
VALIDATED_STATES; update hasValidatedModifier to compute const
hasValidatedModifier = VALIDATED_STATES.includes(validated) and ensure any type
casts or keyof narrowing still work with the shared constant.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c04c5327-b4c5-4f1a-bf77-fbc3967a3f79
📒 Files selected for processing (5)
packages/react-core/src/components/Content/examples/Content.mdpackages/react-core/src/components/TextInputGroup/TextInputGroup.tsxpackages/react-core/src/components/TextInputGroup/TextInputGroupMain.tsxpackages/react-core/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsxpackages/react-core/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx
What: Closes #11834
Extends
TextInputGroupvalidation so it aligns withTextInput,FormSelect, and related controls. Consumers can setvalidated="default"orValidatedOptions.defaultto clear success/warning/error styling after a prior validation state.TextInputGroupvalidatedtype is now'success' | 'warning' | 'error' | 'default' | ValidatedOptions(string literals plus enum, similar toNumberInput).defaultclears validation styling.['success', 'error', 'warning'].includes(validated), sodefaultdoes not add success/warning/error modifiers.ValidatedOptionsis imported fromhelpers/constants, consistent withTextInput/FormSelect.TextInputGroupMainhasStatusIcon), sodefaultdoes not show a status icon.ifbranches (no nested ternaries) andstatusIcons.danger/.success/.warningfor correct TypeScript typing.Tests
validated="default".validated: 'default'.API impact
success/warning/errorusage; the prop type is widened, not narrowed.Summary by CodeRabbit
New Features
defaultvalidation state in the TextInputGroup component, allowing neutral styling without validation indicators.Documentation